#pragma once

#include "singlelayeractor.h"
#include "vrdatacore_global.h"

namespace CoreBase
{
	class Viewer;
	class Scene;
}

namespace VrDataCore
{
	class VRDATACORE_EXPORT CollisionLayer:public SingleLayerActor
	{
	public:
		CollisionLayer();
		virtual void buildPropertyMap();
		virtual void addChild(CoreBase::ActorBase* mactor);
		virtual void removeChild(CoreBase::ActorBase* mactor);
		void setVertexData(QString vertexstring);
		QString getVertexData();
		QVector<osg::ref_ptr<CoreBase::ActorBase>> getCollisionPlaneActorVector();
		virtual void setActive(QString active);
		virtual QString getActive();
		virtual void startUpdateOde(CoreBase::Viewer* viewer,CoreBase::Scene* scene);
		virtual void stopUpdateOde();
		osg::Node* getCollisionDeviceActorRoot();
	protected:
		~CollisionLayer();
		void buildCollisionLayer(const QVector<osg::Vec3>& vertexvector);
		virtual void createDrawable();
		void showCollisionShape();
		void hideCollisionShape();
		bool														_disable;
		QString														_vertexString;
		QVector<osg::ref_ptr<CoreBase::ActorBase>>					_collisionPlaneActor;
		QVector<CoreBase::ActorBase*>								_collisionDeviceActor;
		CoreBase::Viewer*											_viewer;
		CoreBase::Scene*											_scene;
		osg::ref_ptr<osg::StateSet>									_ss;
		osg::ref_ptr<osg::Group>									_group;
		osg::ref_ptr<osg::Group>									_collisionDeviceActorRoot;
	};
}